{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0.         0.52359878 0.78539816 1.04719755 1.57079633]  转成弧度 \n",
      "\n",
      "[ 0. 30. 45. 60. 90.]  转成角度 \n",
      "\n",
      "[0.         0.5        0.70710678 0.8660254  1.        ]\n",
      "[1.00000000e+00 8.66025404e-01 7.07106781e-01 5.00000000e-01\n",
      " 6.12323400e-17]\n",
      "[0.00000000e+00 5.77350269e-01 1.00000000e+00 1.73205081e+00\n",
      " 1.63312394e+16]\n",
      "[ 0. nan nan nan nan]  1 \n",
      "\n",
      "[1.57079633        nan        nan        nan        nan]\n",
      "[0.         1.53747533 1.54857776 1.5541312  1.55968567]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "D:\\Anaconda3\\lib\\site-packages\\ipykernel_launcher.py:11: RuntimeWarning: invalid value encountered in arcsin\n",
      "  # This is added back by InteractiveShellApp.init_path()\n",
      "D:\\Anaconda3\\lib\\site-packages\\ipykernel_launcher.py:12: RuntimeWarning: invalid value encountered in arccos\n",
      "  if sys.path[0] == '':\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    " \n",
    "angle = np.array([0,30,45,60,90]) # 角度\n",
    "radian = angle *np.pi/180\n",
    "print(radian,' 转成弧度 \\n')\n",
    "print (np.degrees(radian),' 转成角度 \\n')\n",
    "print(np.sin(radian))\n",
    "print(np.cos(radian))\n",
    "print(np.tan(radian))\n",
    "\n",
    "print(np.arcsin(angle),' 1 \\n')\n",
    "print(np.arccos(angle))\n",
    "print(np.arctan(angle))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[-2.  1. -1.  0. 10.]\n",
      "[-1.  2. -0.  1. 10.]\n"
     ]
    }
   ],
   "source": [
    "a = np.array([-1.7,  1.5,  -0.2,  0.6,  10])\n",
    "print (np.floor(a))\n",
    "print (np.ceil(a))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[0. 1. 2.]\n",
      " [3. 4. 5.]\n",
      " [6. 7. 8.]]\n",
      "\n",
      "\n",
      "[10 10 10]\n"
     ]
    }
   ],
   "source": [
    "a = np.arange(9, dtype = np.float_).reshape(3,3)  \n",
    "print (a)\n",
    "print ('\\n')\n",
    "b = np.array([10,10,10])  \n",
    "print (b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[0.  0.1 0.2]\n",
      " [0.3 0.4 0.5]\n",
      " [0.6 0.7 0.8]]\n",
      "两个数组相除：\n",
      "[[0.  0.1 0.2]\n",
      " [0.3 0.4 0.5]\n",
      " [0.6 0.7 0.8]]\n"
     ]
    }
   ],
   "source": [
    "print (a/b)\n",
    "print ('两个数组相除：')\n",
    "print (np.divide(a,b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[ 0. 10. 20.]\n",
      " [30. 40. 50.]\n",
      " [60. 70. 80.]]\n",
      "两个数组相乘：\n",
      "[[ 0. 10. 20.]\n",
      " [30. 40. 50.]\n",
      " [60. 70. 80.]]\n"
     ]
    }
   ],
   "source": [
    "print (a * b)\n",
    "print ('两个数组相乘：')\n",
    "print (np.multiply(a,b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[10. 11. 12.]\n",
      " [13. 14. 15.]\n",
      " [16. 17. 18.]]\n",
      "两个数组相加：\n",
      "[[10. 11. 12.]\n",
      " [13. 14. 15.]\n",
      " [16. 17. 18.]]\n"
     ]
    }
   ],
   "source": [
    "print (np.add(a,b))\n",
    "print ('两个数组相加：')\n",
    "print (a + b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-10.  -9.  -8.]\n",
      " [ -7.  -6.  -5.]\n",
      " [ -4.  -3.  -2.]]\n",
      "两个数组相减：\n",
      "[[-10.  -9.  -8.]\n",
      " [ -7.  -6.  -5.]\n",
      " [ -4.  -3.  -2.]]\n"
     ]
    }
   ],
   "source": [
    "print (np.subtract(a,b))\n",
    "print ('两个数组相减：')\n",
    "print (a - b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "我们的数组是：\n",
      "[[3 7 5]\n",
      " [8 4 3]\n",
      " [2 4 9]]\n",
      "\n",
      "\n",
      "2\n",
      "调用 amin() 函数：\n",
      "[3 3 2]\n",
      "\n",
      "\n",
      "再次调用 amin() 函数：\n",
      "[2 4 3]\n"
     ]
    }
   ],
   "source": [
    "a = np.array([[3,7,5],[8,4,3],[2,4,9]])  \n",
    "print ('我们的数组是：')\n",
    "print (a)\n",
    "print ('\\n')\n",
    "print (np.amin(a))\n",
    "print ('调用 amin() 函数：')\n",
    "print (np.amin(a,1))\n",
    "print ('\\n')\n",
    "print ('再次调用 amin() 函数：')\n",
    "print (np.amin(a,0))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
